package com.manpower.ui;

import com.manpower.utl.LocationController;

import android.app.Activity;
import android.app.Dialog;
import android.content.Context;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;

public class ExitDialog extends Dialog {

	private Context mContext;
	private Button mConfirmButton;
	private Button mCancelButton;
	
	public ExitDialog(Context context) {
		super(context);
		mContext = context;
	}
	
	public ExitDialog(Context context, int theme) {
		super(context, theme);
		mContext = context;
	}

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);
		setContentView(R.layout.dialog_exit);
		mConfirmButton = (Button)findViewById(R.id.confirm);
		mCancelButton = (Button)findViewById(R.id.cancel);
		mConfirmButton.setOnClickListener(new android.view.View.OnClickListener() {		
			@Override
			public void onClick(View v) {
				/*ExitDialog.this.cancel();
				((Activity)mContext).finish();*/
				System.exit(0);
			}
		});
		mCancelButton.setOnClickListener(new android.view.View.OnClickListener() {
			
			@Override
			public void onClick(View v) {
				LocationController.getInstance(mContext).stopLocate();
				ExitDialog.this.dismiss();
			}
		});
	}

	
}
